/*
 * CANJaguar1405.hpp
 *
 *  Created on: Mar 18, 2013
 *      Author: trwulff
 */
// TODO: Need Calibrate method
// TODO: Need status method
// TODO: Need technique for detecting jags that are present or not present. 
// This should include a technique for disabeling transaction messages for jags hat not present.
/*
 * Description:
 */
#ifndef CANJAGUAR1405_HPP
#define CANJAGUAR1405_HPP
#include "Constants.hpp"
#include "WPILib.h"
#include <string>
#define PERCENT_CURRENT_FACTOR 40 // max amps for an input of -1 to 1
#define OVERCURRENT_TRIP_CURRENT 40.0 // amps
#define OVERCURRENT_RESET_CURRENT 35.0  //amps

class CANJaguar1405: public CANJaguar
{
public:
	/*
	 * Default constructor
	 */
	typedef enum {kPercentVbus, kCurrent, kSpeed, kPosition, kVoltage,kPercentCurrent,kPercentVI} ControlMode;

	CANJaguar1405(UINT8 deviceNumber, ControlMode controlMode=kPercentVbus); 

	/*
	 * Default destructor
	 */
	~CANJaguar1405();
	void SetPID (double p, double i, double d);
	void Init();
	void ChangeControlMode (ControlMode controlMode);
	void Set (float value, UINT8 syncGroup=0);
	bool Calibrate();
	void InitSMD();
	void Status();
	void SetLog(bool flag);
 
protected:
		void VIControl();
		string ConvertItoA(int deviceNumber);
		ControlMode MyControlMode;
		double mP;
		double mI;
		double mD;
		double VoltageRamp; //TODO: Add other set values
		int InitCount;
		string DeviceID;
		bool InitSMDFlg;
		bool IsOverCurrent;
		bool IsLoggingOn;
		Timer LogTimer;
		bool IsLogTimerOn;
		
		
private:

};



#endif

